Skip to content

CyberSource fixes#15

Open
StanislavSmetaninSSM wants to merge 10 commits into
mainfrom
ssm/28229-cybersource_fixes
Open

CyberSource fixes#15
StanislavSmetaninSSM wants to merge 10 commits into
mainfrom
ssm/28229-cybersource_fixes

Conversation

@StanislavSmetaninSSM
Copy link
Copy Markdown
Contributor

@StanislavSmetaninSSM StanislavSmetaninSSM commented May 14, 2026

This PR improves the DW10 CyberSource checkout handler compatibility and configuration experience.

The main changes are:

  • Fixed the CyberSource cancel flow so cancelled hosted-checkout payments are returned to the cart instead of leaving an incomplete order.
  • Added configurable REST JWT authentication for saved-card payments and captures:
    • Certificate JWT
    • Shared Secret JWT -- This is new one. It can be used for the customer whose don't want to store the certificate on disc.
  • Improved REST request signing and request formatting.
  • Added CyberSource REST request/response debug logging with payment-sensitive values masked.
  • Improved REST error handling so API failures are logged with details but surfaced to users with safe messages.
  • Clarified provider setting labels and help texts.

Note: I can't test payment via saved card/capture using my test account. I get the 401 error (unauthorized user), but I get this error even on the CyberSource tool for certificate testing, so I'm sure that it's the account problem. It must be tested by someone whose account is fine. I'm talking with CyberSource support about it, but they are totally dumb.

Original tasks:
https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/28229
https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/28210
https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/28209

UPD: I will fix the copilot issues, so don't merge it before it, please.

  - Fix cancel flow so cancelled payments restore the cart
  - Add configurable REST JWT authentication for certificate/shared-secret keys
  - Improve REST request signing, error handling, and debug logging
  - Clarify provider setting labels and help texts
  - Fix request formatting and callback validation edge cases
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CyberSource checkout handler for DW10 compatibility, focusing on REST authentication options, safer REST diagnostics, and cancel-flow handling.

Changes:

  • Adds configurable REST authentication settings for certificate JWT and shared-secret JWT.
  • Adds REST request/response logging with masking and safer user-facing REST errors.
  • Updates handler configuration UI, saved-card/capture validation, and cancel-return handling.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Service/CyberSourceService.cs Passes REST authentication settings into REST request handling.
src/Service/CyberSourceRestAuthenticationSettings.cs Adds a settings container for REST authentication and logging options.
src/Service/CyberSourceRequestLogger.cs Adds CyberSource REST diagnostic logging and JSON masking.
src/Service/CyberSourceRequest.cs Updates REST request construction, authentication header generation, and error logging.
src/RestAuthenticationMethod.cs Adds REST authentication method enum values.
src/Helpers/SecurityHelper.cs Clarifies signature helper XML documentation.
src/Helpers/JwtAuthenticationHelper.cs Adds certificate and shared-secret JWT generation helpers.
src/Helpers/Helper.cs Updates certificate path handling and customer-name fallback logic.
src/Dynamicweb.Ecommerce.CheckoutHandlers.CyberSource.csproj Bumps package version and Dynamicweb dependency.
src/CyberSource.cs Adds new settings UI, REST validation, cancel-return flow, and updated service wiring.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/CyberSource.cs
Comment thread src/Service/CyberSourceRequest.cs
Comment thread src/CyberSource.cs
Comment thread src/CyberSource.cs Outdated
Comment thread src/Service/CyberSourceRequestLogger.cs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Comment thread src/Service/CyberSourceRequest.cs Outdated
Comment thread src/CyberSource.cs Outdated
Comment thread src/CyberSource.cs
Comment thread src/CyberSource.cs
Comment thread src/Service/CyberSourceRequestLogger.cs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Comment thread src/CyberSource.cs
Comment thread src/Service/CyberSourceRequestLogger.cs Outdated
Comment thread src/CyberSource.cs Outdated
Comment thread src/Service/CyberSourceRequest.cs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Comment thread src/Helpers/Helper.cs Outdated
Comment thread src/CyberSource.cs Outdated
Comment thread src/Service/CyberSourceRequest.cs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Comment thread src/Helpers/Helper.cs Outdated
Comment thread src/CyberSource.cs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Comment thread src/CyberSource.cs Outdated
Comment thread src/CyberSource.cs
Comment thread src/CyberSource.cs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/Helpers/JwtAuthenticationHelper.cs:81

  • Correct the grammar in this diagnostic message from "Shared Secret JWT token create failed" to "Shared Secret JWT token creation failed".
            throw new Exception("Shared Secret JWT token create failed", ex);

Comment thread src/CyberSource.cs
Comment thread src/Helpers/JwtAuthenticationHelper.cs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Comment thread src/Helpers/Helper.cs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Comment thread src/Service/CyberSourceRequest.cs Outdated
Comment thread src/Helpers/Helper.cs
Comment thread src/CyberSource.cs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants